<template>
  <div class="card-box1">
    <div class="item" v-for="(item,index) in dataArray" :key="index">
      <div class="box-top">
        <div class="label-box">
          <img :src="item.icon" alt="">
          <span>{{ item.name }}</span>
        </div>
      </div>
      <div class="box-center">
        <div class="header-box">
          <span>截止时间：{{ item.time }}</span>
          <span>单位：{{ item.unit }}</span>
        </div>
        <div class="list-bo">
          <div class="items">
            <div class="li">昨天：{{ item.yesDay }}</div>
            <div class="li">前天：{{ item.BeforeYesterday }}</div>
            <div class="li" :class="{
              up: item.dayRate>0,
              down:item.dayRate<0,
            }"><span>同期环比：</span>{{ item.dayRate }}%
              <i class="el-icon-top" v-if="isUp===1"/>
              <i class="el-icon-bottom" v-if="isUp===0"/>
            </div>
          </div>
          <div class="items">
            <div class="li">本月：{{ item.thisMonth }}</div>
            <div class="li">上月：{{ item.lastMonth }}</div>
            <div class="li" :class="{
             up: item.monRate>0,
              down:item.monRate<0,
            }"><span>同期环比：</span>{{ item.monRate }}%
              <i class="el-icon-top" v-if="isUp===1"/>
              <i class="el-icon-bottom" v-if="isUp===0"/>
            </div>
          </div>
          <div class="items">
            <div class="li">去年：{{ item.lastYear }}</div>
            <div class="li">今年：{{ item.thisYear }}</div>
          </div>

        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ['dataArray'],
}
</script>
<style scoped lang="scss">
.card-box1 {
  width: 100%;
  height: 270px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  .item {
    width: 100%;
    height: 258px;
    background: #fff;
    border: 1px solid #eeefef;
    border-radius: 10px;

    .box-top {
      width: 100%;
      height: 40px;
      display: flex;
      justify-content: center;
      align-items: center;

      .label-box {
        width: 140px;
        height: 40px;
        background: #34bfa3;
        border-radius: 8px;
        display: flex;
        justify-content: center;
        align-items: center;

        img {
          width: 24px;
          height: 20px;
          outline: 1px solid #ffffff;
          border-radius: 4px;
        }

        span {
          font-size: 16px;
          color: #fff;
          margin-left: 6px;
        }
      }
    }

    .box-center {
      width: 100%;
      padding-top: 34px;
      padding-left: 20px;
      padding-right: 20px;
      box-sizing: border-box;

      .header-box {
        width: 100%;
        display: flex;
        justify-content: space-between;
        font-size: 14px;
        color: #222;
        font-weight: 600;
      }

      .list-bo {
        width: 100%;
        margin-top: 25px;

        .items {
          width: 100%;
          display: grid;
          grid-template-columns: repeat(3, 1fr);
          gap: 10px;
          border-bottom: 1px #d9d9d9 dashed;
          padding: 5px 0;
          box-sizing: border-box;
          margin-bottom: 8px;

          .li {
            color: #222;
            font-size: 13px;
            font-weight: 600;

            span {
              color: #222;
            }

            i {
              font-size: 16px;
            }

            &.up {
              color: #34bfa3;
            }

            &.down {
              color: #ff0437;
            }
          }
        }
      }
    }
  }
}
</style>
